<?php

namespace App;

use Auth;
use App\Like;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected  $fillable = ['user_id','title','body'];
    public function like()
    {
        $like = new Like([
            'user_id' => Auth::id()
        ]);

        $this->likes()->save($like);
    }

}
